package com.wk.wanjetpack.db

import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.wk.base.DATABASE_NAME
import com.wk.wanjetpack.BaseApplication
import com.wk.wanjetpack.bean.Article
import com.wk.wanjetpack.bean.Tag

/**
 * @author peng
 * @date 2021/1/25
 * 说明
 */

@Database(entities = [Article::class, Tag::class],version = 2,exportSchema = false)
abstract class AppDataBase : RoomDatabase(){

    abstract val articleDao : ArticleDao

    companion object {
        val instance: AppDataBase by lazy(LazyThreadSafetyMode.SYNCHRONIZED){
                    Room.databaseBuilder(BaseApplication.ins,AppDataBase::class.java, DATABASE_NAME).build()
        }
    }
}

